import axios from '@/libs/api.request'
import config from '@/config'

const gaoPing = '/api3'
const saoMa = '/api2'
const api5 = '/api5'

/**
 *  商户景区接口
 */
// 获取信息
export const getPlaceInfoList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcplacepermit/getPlaceInfo',
    type: 'post',
    data: data
  })
}
/**
 *  首页接口
 */
// 文章列表
export const getArticleListNoUserList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcarticle/getArticleListNoUserList',
    type: 'post',
    data: data
  })
}
/**
 *  成功页面接口
 */
// 获取动态串
export const SelectRandomNumber = (data) => {
  return axios.request({
    // url: '/api/uc/ctc/ctcUserPermitService/SelectRandomNumber',
    url: gaoPing + '/uc/ctc/ctcUserPermitService/getRandomNumber',
    type: 'get',
    data: data
  })
}

/**
 *  通行证接口
 */

// 进入页面调用查询接口，根据openid查询是否已经提交过电子通行证
export const getOpenidInfo = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/getOpenidInfo',
    type: 'get',
    data: data
  })
}
// 有无通行证信息，根据type，判断通行证状态
export const getOpenidMsg = (data) => {
  return axios.request({
    url: gaoPing + '/uc/ctc/ctcUserPermitService/getOpenidMsg',
    type: 'get',
    data: data
  })
}

// 有无外卖等人员信息
export const getWorkerInfo = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitWorkerService/getWorkerInfo',
    type: 'post',
    data: data
  })
}
// 保存外卖等人员信息
export const insertWorkerpermit = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/insertWorkerpermit',
    type: 'post',
    data: data
  })
}
// 填写姓名、性别、证件类型、证件号，前台自动调接口备份表接口（使用身份证+姓名方式查询），如果有值将值返回页面展示
export const getCardNoInfo = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/getCardNoInfo',
    type: 'post',
    data: data
  })
}
// 插入表单信息
export const insertUserpermit = (data) => {
  return axios.request({
    url: gaoPing + '/uc/ctc/ctcUserPermitService/insertUserpermit',
    type: 'post',
    data: data
  })
}
// 插入表单信息（外籍）
export const insertCountrypermit = (data) => {
  return axios.request({
    url: gaoPing + '/uc/ctc/ctcUserPermitService/insertCountrypermit',
    type: 'post',
    data: data
  })
}
// 国籍列表（外籍）
export const getNationalityList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/findNationalityList',
    type: 'get',
    data: data
  })
}
// 修改表单信息
export const updatePermitUserMsg = (data) => {
  return axios.request({
    // url: '/api/us/ctc/ctcuserpermit/updatePermitUserMsg',
    url: '/api/uc/ctc/ctcUserPermitService/updateChildPermitInfo',
    type: 'post',
    data: data
  })
}
// 保存其它社区（村）- 地址
export const insertPermitAddress = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/insertPermitAddress',
    type: 'post',
    data: data
  })
}
// 保存其它社区（村）- 亲人
export const insertPermitPerson = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/insertPermitPerson',
    type: 'post',
    data: data
  })
}
// 保存其它社区（村）- 孩子
export const insertPermitChildren = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/insertPermitChildren',
    type: 'post',
    data: data
  })
}
// 根据id删除地址
export const deletePermitAddress = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/deletePermitAddress',
    type: 'post',
    data: data
  })
}
// 根据id删除人员
export const deletePermitPerson = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/deletePermitPerson',
    type: 'post',
    data: data
  })
}
// 根据id删除孩子
export const deletePermitChildern = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/deletePermitChildern',
    type: 'post',
    data: data
  })
}
// 根据cardno获取用户信息
export const getUserPermit = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/getUserPermit',
    type: 'post',
    data: data
  })
}
// 根据openid获取用户信息
export const getUserPermitByOpenId = (data) => {
  return axios.request({
    // url: '/api/us/ctc/ctcuserpermit/getUserPermitByOpenId',
    url: gaoPing + '/uc/ctc/ctcUserPermitService/getOpenidMsg',
    type: 'get',
    data: data
  })
}
// 根据传入随机码获取用户信息
export const getPermitByCode = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/getPermitByCode',
    type: 'post',
    data: data
  })
}
// 传被扫随机码
export const insertUserPermitPlace = (data) => {
  return axios.request({
    url: gaoPing + '/uc/ctc/ctcScanpermitServiceImpl/scanPeople',
    type: 'post',
    data: data
  })
}
// 插入经纬度
export const scanPeopleToSave = (data) => {
  return axios.request({
    url: saoMa + '/uc/ctc/ctcScanpermitServiceImpl/scanPeopleToSave',
    type: 'post',
    data: data
  })
}
// 扫描景区门口的二维码
export const scanGoods = (data) => {
  return axios.request({
    url: gaoPing + '/uc/ctc/ctcScanpermitServiceImpl/scanGoods',
    type: 'post',
    data: data
  })
}
// 扫描景区门口的二维码（插入经纬度）
export const scanGoodsToSave = (data) => {
  return axios.request({
    url: saoMa + '/uc/ctc/ctcScanpermitServiceImpl/scanGoodsToSave',
    type: 'post',
    data: data
  })
}
// 更新经纬度
export const scanGoodsToUpdatelal = (data) => {
  return axios.request({
    url: saoMa + '/uc/ctc/ctcScanpermitServiceImpl/scanGoodsToUpdatelal',
    type: 'post',
    data: data
  })
}
// 根据openid获取多出住所
export const getPermitAddressList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/getPermitAddressList',
    type: 'get',
    data: data
  })
}
// 根据openid获取探望亲人
export const getPermitPersonList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/getPermitPersonList',
    type: 'get',
    data: data
  })
}
// 根据openid获取子女代办
export const getPermitChildrenList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/getPermitChildrenList',
    type: 'get',
    data: data
  })
}
/**
 *  发热记录接口
 */

// 发热温度统计
export const temperatureAlllist = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/temperatureAlllist',
    type: 'post',
    data: data
  })
}
/**
 *  统计接口
 */

// 人员状态统计
export const getAllIllnessStateNum = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/getAllIllnessStateNum',
    type: 'get',
    data: data
  })
}
// 人员状态区统计
export const findAllIllnessStateNumAreaList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/findAllIllnessStateNumAreaList',
    type: 'get',
    data: data
  })
}
// 区县总统计
export const sumAllList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/sumAllList',
    type: 'get',
    data: data
  })
}
// 区县日总统计
export const sumTodayList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/sumTodayList',
    type: 'get',
    data: data
  })
}
// 发热人数区统计
export const sumHotArea = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/findsumHotArealist',
    type: 'get',
    data: data
  })
}
// 发热人数日统计
export const sumHotDaty = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/findsumHotDatylist',
    type: 'get',
    data: data
  })
}
// 途经类型人数区统计
export const sumAddressTypeArea = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/findsumAddressTypeArealist',
    type: 'get',
    data: data
  })
}
// 途经类型人数日统计
export const sumAddressTypeDate = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/findsumAddressTypeDatelist',
    type: 'post',
    data: data
  })
}
// 密切接触人数区统计
export const findsumFollowArealist = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/findsumFollowArealist',
    type: 'get',
    data: data
  })
}
// 密切接触人数日统计
export const findsumFollowDatylist = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/findsumFollowDatylist',
    type: 'get',
    data: data
  })
}

/**
 *  人员发热列表接口
 * @returns {Promise | Promise<unknown> | AxiosPromise}
 */
export const temperaturelist = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/temperaturelist',
    type: 'post',
    data: data
  })
}
export const userlist = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/userlist',
    type: 'post',
    data: data
  })
}
// 添加体温信息
export const createtemperature = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/ac/csc/HatStateService/createtemperature',
    type: 'post',
    data: data
  })
}

export function date0str (date, containtime) {
  if (!date || typeof date === 'string') {
    return date
  }
  var time1 = date.getFullYear()
  var month = date.getMonth() + 1
  var day = date.getDate()
  var hour = date.getHours()
  var min = date.getMinutes()
  var second = date.getSeconds()
  time1 += '-' + (month < 10 ? '0' + month : month)
  time1 += '-' + (day < 10 ? '0' + day : day)
  time1 += ' ' + (hour < 10 ? '0' + hour : hour)
  time1 += ':' + (min < 10 ? '0' + min : min)
  time1 += ':' + (second < 10 ? '0' + second : second)
  return time1
}

// 添加发热人员信息
export const createuserinfo = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/ac/csc/HatStateService/createuserinfo',
    type: 'post',
    data: data
  })
}
export const createuserinfoApp = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/uc/csc/HatStateService/createuserinfoApp',
    type: 'post',
    data: data
  })
}
// 修改发热人员信息
export const updateuserinfo = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/ac/csc/HatStateService/updateuserinfo',
    type: 'post',
    data: data
  })
}
// 用户id查询人员基本信息
export const getuserinfo = (userid) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/userinfo',
    type: 'post',
    data: { id: userid }
  })
}
// 用户id删除人员信息
export const delbyid = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/delbyid',
    type: 'post',
    data: data
  })
}
// 添加绑定信息(1同行人|2接触人)
export const createuserband = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/createuserband',
    type: 'post',
    data: data
  })
}
// 删除绑定信息(1同行人|2接触人)
export const delbanduser = (bandid) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/delbanduser',
    type: 'post',
    data: { id: bandid }
  })
}
// 更新绑定信息(1同行人|2接触人)
export const updatebanduser = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/updatebanduser',
    type: 'post',
    data: data
  })
}
// 查询绑定信息-分页接口(1同行人|2接触人)
export const banduserlist = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/banduserlist',
    type: 'post',
    data: data
  })
}
// 删除体温信息
export const deltemperature = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/deltemperature',
    type: 'post',
    data: data
  })
}
// 更新体温信息
export const updatetemperature = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/ac/csc/HatStateService/updatetemperature',
    type: 'post',
    data: data
  })
}
// 区，街道，社区级联接口
export const getMailLevelList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/auditmail/getMailLevelList',
    type: 'post',
    data: data
  })
}
// 人员信息迁出接口
export const updateusercompanycode = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/updateusercompanycode',
    type: 'post',
    data: data
  })
}
// 人员信息导出接口
export const findOutAllList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/ac/csc/HatStateService/findOutAllList',
    type: 'post',
    data: data
  })
}
// 迁入人员列表接口
export const findInApplyList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/findInApplyList',
    type: 'post',
    data: data
  })
}
// 迁出人员列表接口
export const findOutApplyList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/findOutApplyList',
    type: 'post',
    data: data
  })
}
// 迁入同意
export const updateAgree = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/updateAgree',
    type: 'post',
    data: data
  })
}
// 迁入拒绝
export const updateDisAgree = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/updateDisAgree',
    type: 'post',
    data: data
  })
}
// 添加申请
export const createOutApplu = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/createOutApplu',
    type: 'post',
    data: data
  })
}
// 上级查看下级人员列表接口
export const userUpList = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/as/csc/hatstate/userUpList',
    type: 'post',
    data: data
  })
}
/* 自查提报疫情现居地 */
export const downlist = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/auditmail/downlist',
    data: data,
    type: 'post'
  })
}
/* 自查提报通过身份证查询 */
export const userinfoByCardNo = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstate/userinfoByCardNoApp',
    data: data,
    type: 'post'
  })
}
// 疫情类型列表
export const epidemicSituationList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctclove/epidemicSituationList',
    type: 'post',
    data: data
  })
}
// 疫情类型信息详情
export const getEpidemicSituationInfo = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctclove/getEpidemicSituationInfo',
    type: 'post',
    data: data
  })
}
// 出入证个人信息
export const hatstateappuserinfo = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/us/csc/hatstateapp/userinfo',
    type: 'post',
    data: data
  })
}
// 校验身份证是否重复
export const getUserInfoAppById = (data) => {
  return axios.request({
    url: config.baseUrlMZ + '/api/uc/csc/HatStateService/getUserInfoAppById',
    type: 'post',
    data: data
  })
}
// 获取外卖快递的健康状态接口
export const getWorkerInfoList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/getWorkerInfoList',
    type: 'post',
    data: data
  })
}
// 获取外卖快递的健康状态接口(新)
export const getWorkerDetailInfoList = (data) => {
  return axios.request({
    url: '/api/us/ctc/ctcuserpermit/getWorkerDetailInfoList',
    type: 'post',
    data: data
  })
}
// 获取用户关系层级
export const findPermitPersonList = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/findPermitPersonList',
    type: 'get',
    data: data
  })
}

// 获取个人职业信息
export const getWorkerList = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/getWorkerList',
    type: 'get',
    data: data
  })
}

/**
 * 调用国家接口
 * @param data
 * @returns {Promise | Promise<unknown> | AxiosPromise}
 */
export const getHealthInfo = (data) => {
  return axios.request({
    url: '/api/uc/ctc/getHealthInfoService/getHealthInfo',
    type: 'post',
    data: data
  })
}
// 补贴劵查询是否已经报名接口
export const getByOpenid = (data) => {
  return axios.request({
    url: api5 + '/uc/ctc/ctSignupRecordService/getByOpenid',
    type: 'get',
    data: data,
    goApi: 'api5'
  })
}
// 补贴劵查询是否已经报名接口（图书卷）
export const getByOpenidBook = (data) => {
  return axios.request({
    url: api5 + '/uc/ctc/ctBookSignupRecordService/getByOpenid',
    type: 'get',
    data: data,
    goApi: 'api5'
  })
}
// 补贴劵报名接口
export const ctSignupRecordInsert = (data) => {
  return axios.request({
    url: api5 + '/uc/ctc/ctSignupRecordService/signup',
    type: 'post',
    data: data
  })
}
// 补贴劵报名接口(图书卷）
export const ctSignupRecordInsertBook = (data) => {
  return axios.request({
    url: api5 + '/uc/ctc/ctBookSignupRecordService/signup',
    type: 'post',
    data: data
  })
}
// 优惠券冲正接口
export const reverseCoupon = (data) => {
  return axios.request({
    url: api5 + '/uc/ctc/couponService/reverseCoupon',
    type: 'get',
    data: data
  })
}
// 查询优惠券
export const getCoupon = (data) => {
  return axios.request({
    url: api5 + '/uc/ctc/couponService/getCoupon',
    type: 'get',
    data: data
  })
}

/**
 * 跳转到辽宁
 * @param data
 * @returns {Promise<unknown> | AxiosPromise}
 */
export const toLST = (data) => {
  return axios.request({
    url: gaoPing + '/uc/ctc/wechatLSTService/toLST',
    type: 'get',
    data: data
  })
}
// 国家二维码
export const getHealthInfofm = (data) => {
  return axios.request({
    url: '/api/uc/ctc/getHealthInfoService/getHealthInfofm',
    type: 'get',
    data: data
  })
}
// 国家二维码扫一扫
export const qrCodeGetUserInfo = (data) => {
  return axios.request({
    url: '/api/uc/ctc/getHealthInfoService/qrCodeGetUserInfo',
    type: 'post',
    data: data
  })
}
// 新代办-父母
export const insertNewPermitPerson = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/newPermitPerson',
    type: 'post',
    data: data
  })
}
// 新代办-儿童
export const insertNewPermitChildren = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/newPermitChildren',
    type: 'post',
    data: data
  })
}
// 新代办-查看详情
export const getByCardNo = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/getByCardNo',
    type: 'post',
    data: data
  })
}
// 新代办-修改
export const userUpdatepermit = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/userUpdatepermit',
    type: 'post',
    data: data
  })
}
// 新代办-随机数
export const getRandomNumber1 = (data) => {
  return axios.request({
    url: '/api/uc/ctc/ctcUserPermitService/getRandomNumber1',
    type: 'post',
    data: data
  })
}
// 新代办-随机数
export const petrolStationServiceList = (data) => {
  return axios.request({
    url: api5 + '/uc/ctc/petrolStationService/findList',
    type: 'get',
    data: data
  })
}
